package com.soft.bams.vo;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/5/5
 */
public class RankVO implements Comparable<RankVO>{
     private String personId;
     private String name;
     private double total;

    public RankVO(String personId, String name, double total) {
        this.personId = personId;
        this.name = name;
        this.total = total;
    }

    public String getPersonId() {
        return personId;
    }

    public String getName() {
        return name;
    }

    public double getTotal() {
        return total;
    }

    public void addAsset(double amount) {
        this.total += amount;
    }

    @Override
    public int compareTo(RankVO o) {
        if(this.total == o.total){
            return this.personId.compareTo(o.personId);
        }
        return Double.compare(o.total, this.total);
    }

    @Override
    public String toString() {
        return "RankVO{" +
                "personId='" + personId + '\'' +
                ", name='" + name + '\'' +
                ", total=" + total +
                '}';
    }
}
